package com.emeraldparser.util;

import static com.google.common.collect.Collections2.filter;

import java.util.AbstractCollection;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;

import com.google.common.base.Predicates;
import com.google.common.collect.Multiset;

public abstract class CollectionBasedMultiset<E> extends AbstractCollection<E> implements Multiset<E> {

	protected abstract Collection<E> collection();

	@Override
	public int count(Object element) {
		return filter(collection(), Predicates.equalTo(element)).size();
	}

	@Override
	public int add(E element, int occurrences) {
		// TODO Auto-generated method stub
		int oldCount = count(element);
		
		
		
		return oldCount;
	}

	@Override
	public int remove(Object element, int occurrences) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int setCount(E element, int count) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public boolean setCount(E element, int oldCount, int newCount) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public Set<E> elementSet() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Set<Multiset.Entry<E>> entrySet() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Iterator<E> iterator() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int size() {
		return collection().size();
	}

}
